package org.duang.plugins;

import java.util.HashMap;
import java.util.Map;

import org.duang.config.Config;
import org.duang.db.Connection;
import org.duang.push.WebSocket;

/**
 * WebSocketPlugin(基于netty开发)
 * @author laotang
 */
public class WebSocketPlugin implements IPlugin {

	public void start() throws Exception{
		Map<String, String> optionMap = new HashMap<String,String>();
		optionMap.put(Connection.HOST_FIELD, Config.getWebSocketHost());
		optionMap.put(Connection.PORT_FIELD, Config.getWebSocketPort());
		WebSocket.getInstance().connect(optionMap);
	}

	public void stop() throws Exception{
		WebSocket.getInstance().close();
	}

}
